import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2025-07-05
 * Time: 13:10
 */
public class Test27 {
    public static class ListNode{
        int val;
        ListNode next;

        ListNode(int val) {
            this.val = val;
            next = null;
        }

        ListNode() {

        }
    }

    public static ListNode mergeTwoList(ListNode l1,ListNode l2) {
        ListNode newHead = new ListNode();
        ListNode cur = newHead;
        while(l1 != null && l2 != null) {
            if(l1.val < l2.val) {
                cur.next = l1;
                l1 = l1.next;
            }else {
                cur.next = l2;
                l2 = l2.next;
            }
            cur = cur.next;
        }

        if(l1 != null) {
            cur.next = l1;
        }

        if(l2 != null) {
            cur.next = l2;
        }

        return newHead.next;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ListNode head1 = null, tail1 = null;
        int n1 = sc.nextInt();
        for(int i = 0; i < n1; i++) {
            int val = sc.nextInt();
            ListNode node = new ListNode(val);
            if(head1 == null) {
                head1 = node;
            } else {
                tail1.next = node;
            }
            tail1 = node;
        }
        ListNode head2 = null, tail2 = null;
        int n2 = sc.nextInt();
        for(int i = 0; i < n2; i++) {
            int val = sc.nextInt();
            ListNode node = new ListNode(val);
            if(head2 == null) {
                head2 = node;
            } else {
                tail2.next = node;
            }
            tail2 = node;
        }
        ListNode cur = mergeTwoList(head1,head2);
        while(cur != null) {
            System.out.print(cur.val+" ");
            cur = cur.next;
        }
    }
}
